package com.waypolice.db;

import org.apache.commons.dbcp.BasicDataSource;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * Created by 312小时 on 2018/8/25.
 */
public class ConstructionBankDataDao{

    public  BasicDataSource dataSource;
    private Connection con=null;

    /**
     * 获取数据源
     * @param dataSource
     */
    public ConstructionBankDataDao(BasicDataSource dataSource) {
        this.dataSource = dataSource;
    }


    /**
     * 获取连接
     * @return
     */
    public Connection getConnection(){
        try {
            con= dataSource.getConnection();
            //设置自动提交为false
            con.setAutoCommit(false);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return con;
    }


}
